package gunfire.cards;

import basemod.abstracts.CustomCard;
import com.megacrit.cardcrawl.cards.AbstractCard;
import com.megacrit.cardcrawl.cards.DamageInfo;
import com.megacrit.cardcrawl.characters.AbstractPlayer;
import com.megacrit.cardcrawl.core.CardCrawlGame;
import com.megacrit.cardcrawl.dungeons.AbstractDungeon;
import com.megacrit.cardcrawl.localization.CardStrings;
import com.megacrit.cardcrawl.monsters.AbstractMonster;
import gunfire.GunfireMod;
import gunfire.actions.DoubleCaliberAction;
import gunfire.characters.Taizi;

import static gunfire.GunfireMod.makeCardPath;

public class DoubleCaliber extends CustomCard {

    public static final String ID = GunfireMod.makeID(DoubleCaliber.class.getSimpleName());
    private static final CardStrings cardStrings = CardCrawlGame.languagePack.getCardStrings(ID);
    public static final String NAME = cardStrings.NAME;
    public static final String DESCRIPTION = cardStrings.DESCRIPTION;
    public static final String IMG = makeCardPath("DoubleCaliber.png");
    private static final CardRarity RARITY = CardRarity.UNCOMMON;
    private static final CardType TYPE = CardType.ATTACK;
    private static final CardTarget TARGET = CardTarget.ENEMY;
    public static final CardColor COLOR = Taizi.Enums.COLOR_GRAY;
    private static final int COST = 2;

    public DoubleCaliber() {
        super(ID, NAME, IMG, COST, DESCRIPTION, TYPE, COLOR, RARITY, TARGET);
        this.baseDamage = 10;
        this.exhaust = true;
    }

    @Override
    public void upgrade() {
        if (!this.upgraded) {
            this.upgradeName();
            this.upgradeDamage(4);
        }
    }

//    不会计算易伤，暂时移除
//    @Override
//    public void triggerOnGlowCheck() {
//        this.glowColor = AbstractCard.BLUE_BORDER_GLOW_COLOR.cpy();
//
//        for (AbstractMonster m : AbstractDungeon.getCurrRoom().monsters.monsters) {
//            if (!m.isDeadOrEscaped() && m.currentHealth + m.currentBlock <= this.damage) {
//                this.glowColor = AbstractCard.GOLD_BORDER_GLOW_COLOR.cpy();
//                break;
//            }
//        }
//    }

    @Override
    public void use(AbstractPlayer p, AbstractMonster m) {
        this.addToBot(new DoubleCaliberAction(m, new DamageInfo(p, this.damage, DamageInfo.DamageType.NORMAL), this.upgraded));
    }

    @Override
    public AbstractCard makeCopy() {
        return new DoubleCaliber();
    }
}
